import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import com.university.rmi.RemoteObject;
import com.university.rmi.RemoteObjectConsts;


public class ServerRMI {

    public static void main(String[] args) throws RemoteException, AlreadyBoundException {
	RemoteObject obj;
	
//	try {
	    obj = new RemoteObjectImpl();
	    //RemoteObject stub = (RemoteObjectImpl) UnicastRemoteObject.exportObject(obj, 0);
	    Registry registry = LocateRegistry.createRegistry(RemoteObjectConsts.RMI_PORT);
	    registry.bind(RemoteObjectConsts.RMI_ID, obj);
//	} catch (RemoteException e) {
//	    e.printStackTrace();
//	} catch (AlreadyBoundException e) {
//	    e.printStackTrace();
//	}
    }

}
